import Obs from "ulearning-obs/dist/obs-huawei.js";
import { COURSE_API_HOST } from "@/plugins/config.js";
import cookies from '@/utils/cookie.js';

const obsUploader = (platform, options = {}) => {
  if (!platform) return null;
  const obs = new Obs({
    authorization: cookies.get(`AUTHORIZATION_${platform.toUpperCase()}`), // 平台token
    uptokenHost: COURSE_API_HOST, // 平台api域名
    obsHost: '', // 文件上传后的访问地址
    ...options
  });
  return obs;
};

export { obsUploader };
